package com.ruoyi.constituent.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SNUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.constituent.mapper.ConstituentDetailMapper;
import com.ruoyi.constituent.domain.ConstituentDetail;
import com.ruoyi.constituent.service.IConstituentDetailService;

/**
 * 成分明细Service业务层处理
 * 
 * @author weihanqiang
 * @date 2025-09-16
 */
@Service
public class ConstituentDetailServiceImpl implements IConstituentDetailService 
{
    @Autowired
    private ConstituentDetailMapper constituentDetailMapper;


    /**
     * 查询成分明细
     * 
     * @param id 成分明细主键
     * @return 成分明细
     */
    @Override
    public ConstituentDetail selectConstituentDetailById(Long id)
    {
        return constituentDetailMapper.selectConstituentDetailById(id);
    }

    /**
     * 查询成分明细列表
     * 
     * @param constituentDetail 成分明细
     * @return 成分明细
     */
    @Override
    public List<ConstituentDetail> selectConstituentDetailList(ConstituentDetail constituentDetail)
    {
        return constituentDetailMapper.selectConstituentDetailList(constituentDetail);
    }

    /**
     * 新增成分明细
     * 
     * @param constituentDetail 成分明细
     * @return 结果
     */
    @Override
    public int insertConstituentDetail(ConstituentDetail constituentDetail)
    {
        constituentDetail.setCreateTime(DateUtils.getNowDate());
        return constituentDetailMapper.insertConstituentDetail(constituentDetail);
    }

    /**
     * 修改成分明细
     * 
     * @param constituentDetail 成分明细
     * @return 结果
     */
    @Override
    public int updateConstituentDetail(ConstituentDetail constituentDetail)
    {
        return constituentDetailMapper.updateConstituentDetail(constituentDetail);
    }

    /**
     * 批量删除成分明细
     * 
     * @param ids 需要删除的成分明细主键
     * @return 结果
     */
    @Override
    public int deleteConstituentDetailByIds(Long[] ids)
    {
        return constituentDetailMapper.deleteConstituentDetailByIds(ids);
    }

    /**
     * 删除成分明细信息
     * 
     * @param id 成分明细主键
     * @return 结果
     */
    @Override
    public int deleteConstituentDetailById(Long id)
    {
        return constituentDetailMapper.deleteConstituentDetailById(id);
    }
}
